home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / scope / 176-200 / scopedisk192 / unzipv3.1 / zip_proto.i < prev   
Text File  |  1995-03-19  |  3KB  |  105 lines

  1. #include <proto/exec.h>
  2. #include <string.h>
  3. #include <stdlib.h>
  4. #include <stdio.h>
  5. #define ASTERISK '*'        /* The '*' metacharacter */
  6. #define QUESTION '?'        /* The '?' metacharacter */
  7. #define BACK_SLASH '\\'         /* The '\' metacharacter */
  8. #define LEFT_BRACKET '['    /* The '[' metacharacter */
  9. #define RIGHT_BRACKET ']'   /* The ']' metacharacter */
  10.  
  11. #define IS_OCTAL(ch) (ch >= '0' && ch <= '7')
  12.  
  13. typedef short int INT;      /* v2.0b */
  14. typedef short int BOOLEAN;  /* v2.0b */
  15. #define TRUE 1
  16. #define FALSE 0
  17. #define EOS '\000'
  18.  
  19. #define OUTBUFSIZ 0x2000        /* unImplode needs power of 2, >= 0x2000 */
  20. #define LITVALS     256
  21. #define DISTVALS    64
  22. #define LENVALS     64
  23. #define MAXSF       LITVALS
  24.    typedef struct sf_entry {
  25.        byte         Value;
  26.        byte         BitLength;
  27.    } sf_entry;
  28.  
  29.    typedef struct sf_tree {   /* a shannon-fano "tree" (table) */
  30.       sf_entry     entry[MAXSF];
  31.       int          entries;
  32.       int          MaxLength;
  33.    } sf_tree;
  34.  
  35.    typedef sf_tree      *sf_treep;
  36.  
  37.    typedef struct sf_node {   /* node in a true shannon-fano tree */
  38.       UWORD         left;      /* 0 means leaf node */
  39.       UWORD         right;     /* or value if leaf node */
  40.    } sf_node;
  41.  
  42. typedef short int BOOLEAN;
  43. typedef unsigned char byte;
  44.  
  45. #define UPDCRC32(res,oct) res=crc_32_tab[(byte)res^(byte)oct] ^ ((res>>8) & 0x00FFFFFFL)
  46. /* Prototypes for functions defined in ascebc.c */
  47. /* Prototypes for functions defined in crc32.c */
  48. void UpdateCRC(unsigned char *s,
  49.                int len);
  50. /* Prototypes for functions defined in mapname.c */
  51. int mapped_name(void);
  52. /* Prototypes for functions defined in match.c */
  53. int match(char *string,
  54.           char *pattern);
  55. BOOLEAN do_list(char *string,
  56.                        char *pattern);
  57. void list_parse(char **patp,
  58.                        char *lowp,
  59.                        char *highp);
  60. char nextch(char **patp);
  61. /* Prototypes for functions defined in unzip.c */
  62. void set_file_time(void);
  63. int create_output_file(void);
  64. int open_input_file(void);
  65. int __regargs readbuf(int fd,
  66.             char *buf,
  67.             unsigned int size);
  68. int ReadByte(UWORD *x);
  69. int __regargs FillBitBuffer(int bits);
  70. int dos2unix(unsigned char *buf,
  71.              int len);
  72. void WriteBuffer(int fd,
  73.                  unsigned char *buf,
  74.                  int len);
  75. void FlushOutput(void);
  76. void LoadFollowers(void);
  77. void unReduce(void);
  78. void partial_clear(void);
  79. void unShrink(void);
  80. void SortLengths(sf_tree *tree);
  81. void ReadLengths(sf_tree *tree);
  82. void GenerateTrees(sf_tree *tree,
  83.                    sf_node *nodes);
  84. void LoadTree(sf_tree *tree,
  85.               int treesize,
  86.               sf_node *nodes);
  87. void LoadTrees(void);
  88. void ReadTree(sf_node *nodes,
  89.               int *dest);
  90. void unImplode(void);
  91. void dir_member(void);
  92. void skip_member(void);
  93. void extract_member(void);
  94. void get_string(int len,
  95.                 char *s);
  96. void process_local_file_header(char **fnamev);
  97. void process_central_file_header(void);
  98. void process_end_central_dir(void);
  99. void process_headers(void);
  100. void skip_to_signature(void);
  101. void process_zipfile(void);
  102. void usage(void);
  103. void main(int argc,
  104.           char **argv);
  105.